<template>
  <!-- 跳转到详情页 -->
  <view @click="handleClick">
    <slot></slot>
  </view>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: []
    },
    index: {
      type: Number,
      default: 0
    }
  },
  methods: {
    handleClick() {
      /**
       * 1 将数据缓存
       * 2 实现点击跳转页面
       */
      getApp().globalData.imgList = this.list
      getApp().globalData.imgIndex = this.index
      uni.navigateTo({
        url: '/pages/imgDetail/index'
      })
    }
  }
}
</script>

<style>
</style>